import request from '/@/utils/request';
//根据相应条件查询
export const selectItineraryByCondition = (params?: any) => {
    return request({
        url: '/itinerary/itinerary/selectItineraryByCondition',
        method: 'get',
        params
    });
};
//删除行程库
export const deleteItinerary = (params: any) => {
    return request({
        url: '/itinerary/itinerary/deleteItinerary', // 只保留基础路径
        method: 'delete',
        params: params
    })
};
//批量删除行程库
export const deleteItineraryBatch = (ids: number[]) => {
    return request({
        url: '/itinerary/itinerary/deleteBatch',
        method: 'delete',
        data: ids // 传递数字数组
    });
};
// 定义请求参数类型，与后端 TrItineraryAddDTO 对应
interface TrItineraryAddParams {
    itineraryName: string;
    remark?: string;
    trItineraryContents: Array<{
        itineraryContentName: string;
        traDuringNumber: number;
        traDuringUnit: string;
        content: string;
        image1?: string;
        image2?: string;
        image3?: string;
        remark?: string;
    }>;
}
// 添加行程库以及其内容
export const addItineraryWithContent = (params: TrItineraryAddParams) => {
    return request({
        url: '/itinerary/itinerary', // 简化URL路径
        method: 'post',
        data: params
    }).catch(error => {
        console.error('添加行程库失败:', error);
        throw error;
    });
};

